package ACM_Brush;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Solution003 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.nextLine();
        System.out.printf("%d", new mySolution003().method003(s));
        in.close();
    }
}

class mySolution003 {
    public int method003(String s) {
        if (s.length() == 0)
            return 0;
        Map<Character, Integer> map = new HashMap<>();
        int left = 0;
        int result = 0;
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if (map.containsKey(c)) {
                left = Math.max(map.get(c) + 1, left);
            }
            result = Math.max(result, i - left + 1);
            map.put(c, i);
        }
        return result;
    }
}
